import 'package:bloc/bloc.dart';

enum EmojiEvent { toggle, hide }

class EmojiBloc extends Bloc<EmojiEvent, bool> {
  @override
  bool get initialState => false;

  bool isShow = false;

  @override
  Stream<bool> mapEventToState(EmojiEvent event) async* {
    switch (event) {
      // 切换emoji显示
      case EmojiEvent.toggle:
        isShow = !isShow;
        yield isShow;
        break;
      // 隐藏
      case EmojiEvent.hide:
        isShow = false;
        yield false;
        break;
    }
  }

}